home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / libs / unixlib.lha / unix / include / signal.h < prev    next >
C/C++ Source or Header  |  1996-10-16  |  2KB  |  75 lines

  1. #ifndef _SIGNAL_H
  2. #define _SIGNAL_H
  3.  
  4. #include <sys/types.h>
  5.  
  6. #define NSIG 32            /* We define lots of signals (though most are
  7.                    never generated) */
  8.  
  9. /* Signal number definitions */
  10. /* Those which can be generated other than by kill are described with
  11.     <name>, amiga: <cause> */
  12.    
  13.  
  14. #define SIGHUP 1        /* hangup */
  15. #define SIGINT 2        /* interrupt, amiga: ctrl-c */
  16. #define SIGQUIT 3        /* quit, amiga: ctrl-d */
  17. #define SIGILL 4        /* illegal instruction */
  18. #define SIGTRAP 5        /* trace trap */
  19. #define SIGIOT 6        /* abort, amiga: abort() called */
  20. #define SIGABRT SIGIOT        /* compatibility */
  21. #define SIGEMT 7        /* emulator trap */
  22. #define SIGFPE 8        /* arithmetic exception, amiga: arith op */
  23. #define SIGKILL 9        /* kill */
  24. #define SIGBUS 10        /* bus error */
  25. #define SIGSEGV 11        /* segmentation violation */
  26. #define SIGSYS 12        /* bad argument to system call */
  27. #define SIGPIPE 13        /* write on pipe or socket with no reader,
  28.                    amiga: generated for 'pipe's or 'sktpair's */
  29. #define SIGALRM 14        /* alarm clock, amiga: see alarm */
  30. #define SIGTERM 15        /* software termination */
  31. #define SIGURG 16        /* urgent condition on socket */
  32. /* SIGSTOP, SIGTSTP, SIGCONT, SIGTTIN, SIGTTOU undefined to avoid creating the
  33.    belief that we support stopped processes */
  34. #define SIGCHLD 20        /* child status has changed */
  35. #define SIGIO 23        /* I/O possible on a descriptor */
  36. /* Less usual signals: SIGXCPU, SIGXFSZ, SIGVTALARM, SIGPROF, SIGLOST not defined */
  37. #define SIGWINCH 28        /* window changed */
  38. #define SIGUSR1 30        /* user-defined signal 1 */
  39. #define SIGUSR2 31        /* user-defined signal 2 */
  40.  
  41. #if 0
  42. #define SIG_DFL (void *)0
  43. #define SIG_IGN (void *)1
  44. #else
  45. #define SIG_ERR (void (*)(int)) -1
  46. #define SIG_DFL (void (*)(int)) 0
  47. #define SIG_IGN (void (*)(int)) 1
  48. #endif
  49.  
  50. /*
  51.  * Flags for sigprocmask:
  52.  */
  53. #define SIG_BLOCK    1    /* block specified signal set */
  54. #define SIG_UNBLOCK    2    /* unblock specified signal set */
  55. #define SIG_SETMASK    3    /* set specified signal set */
  56.  
  57. /*
  58.  * Macro for converting signal number to a mask
  59.  */
  60. #define sigmask(m)    (1UL << (m))
  61.  
  62. typedef long sigset_t;
  63.  
  64. extern void (*signal(int sig,void (*fn)(int)))(int);
  65. extern int raise(int);
  66. extern long sigsetmask(long mask);
  67. extern int sigprocmask(int, const sigset_t *, sigset_t *);
  68.  
  69. /* Only kill(getpid(), sig) works */
  70. /* Also, getpid() is a unique number for this process */
  71. extern int getpid(void);
  72. extern int kill(int pid, int sig);
  73.  
  74. #endif
  75.